package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpInventoryCheckOutPageUtil extends SeleniumPageUtil {
	public final static By ICO_SPAN_MAIN_HEADER = By.id("ctl44_lblHdr");
	public final static By ICO_TD_SRO_NO = By.xpath("//*[@id='frameHeader']/table/tbody/tr[1]/td[1]");
	public final static By ICO_INPUT_SRO_NO = By.id("ctl44_txtSroNumber");
	public final static By ICO_TD_WAREHOUSE = By.xpath("//*[@id='frameHeader']/table/tbody/tr[2]/td[1]");
	public final static By ICO_INPUT_WAREHOUSE = By.id("ctl44_txtWarehouse");
	public final static By ICO_TD_ITEM_SERIAL_NO = By.xpath("//*[@id='ctl44_PnlForm']/table[1]/tbody/tr[1]/td[1]");
	public final static By ICO_INPUT_ITEM_SERIAL_NO = By.id("ctl44_txtItemSerialNumber");
	
	// elements of checked out section
	public final static By ICO_SPAN_SECTION_HEADER = By.id("ctl44_checkedOutSectionHeader");
	public final static By ICO_TH_SECTION_SRO_NO = By.xpath("//*[@id='ctl44_LblInventoryList']/table/tbody/tr/th[1]");
	public final static By ICO_TH_SECTION_ITEM_NO = By.xpath("//*[@id='ctl44_LblInventoryList']/table/tbody/tr/th[2]");
	public final static By ICO_TH_SECTION_WHSE = By.xpath("//*[@id='ctl44_LblInventoryList']/table/tbody/tr/th[3]");
	public final static By ICO_TH_SECTION_BIN_NO = By.xpath("//*[@id='ctl44_LblInventoryList']/table/tbody/tr/th[4]");
	public final static By ICO_TH_SECTION_SERIAL_NO = By.xpath("//*[@id='ctl44_LblInventoryList']/table/tbody/tr/th[5]");
	public final static By ICO_TH_SECTION_CHECKED_OUT = By.xpath("//*[@id='ctl44_LblInventoryList']/table/tbody/tr/th[6]");
	
	public final static By ICO_TD_NOTE = By.xpath("//*[@id='ctl44_PnlForm']/table[1]/tbody/tr[2]/td");
	public final static By ICO_INPUT_SUBMIT = By.id("ctl44_btnSubmit");
	
	public static void enterInventoryCheckOutPage() {
		SpHomePageUtil.enter();
		SpHomePageUtil.enterInventoryCheckOutPage();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				ICO_SPAN_MAIN_HEADER, ICO_SPAN_SECTION_HEADER, ICO_TD_NOTE, ICO_INPUT_SUBMIT
			});
		
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(ICO_SPAN_MAIN_HEADER));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(ICO_SPAN_SECTION_HEADER));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(ICO_TD_NOTE));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(ICO_INPUT_SUBMIT));
	}
}
